package com.yyi.springcloud.service.impl;


import com.yyi.springcloud.dao.GroupInfoMapper;
import com.yyi.springcloud.entities.GroupInfoModel;
import com.yyi.springcloud.service.Local_GroupInfoService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import tk.mybatis.mapper.entity.Example;

import javax.annotation.Resource;
import java.util.List;

@Service
public class Local_GroupInfoServiceImpl implements Local_GroupInfoService {

    @Resource
    private GroupInfoMapper groupInfoDao;


    @Override
    public List<GroupInfoModel> getAllGroupInfoByCondition(GroupInfoModel groupInfoModel) {
        Example example = new Example(GroupInfoModel.class);
        Example.Criteria criteria = example.createCriteria();
        if(groupInfoModel==null){
            return null;
        }

        if(!StringUtils.isEmpty(groupInfoModel.getPrimarykey())){
            criteria.andLike("primarykey",groupInfoModel.getPrimarykey()+"%");
        }
        return groupInfoDao.selectByExample(example);
    }
}

